package org.smile.db.handler;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
 * 把结果转为List
 * @author Administrator
 */
public class ListRowHandler implements RowHandler {
	@SuppressWarnings("unchecked")
	public Object handle(ResultSet rs) throws SQLException {
		List result=new ArrayList();
        ResultSetMetaData rsmd = rs.getMetaData();
        int cols = rsmd.getColumnCount();
        for (int i = 1; i <= cols; i++) {
            result.add(rs.getObject(i));
        }
        return result;
	}
}
